package com.pac.doctor.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.pac.doctor.bean.DoctorBean;
import com.pac.doctor.dao.DoctorDao;

/**
 * 医生信息dao实现
 * 
 * @author lujun.chen
 * @version [版本号, 2015年3月2日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Repository(value = "doctorDao")
public class DoctorDaoImpl implements DoctorDao {

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public String addDoctor(DoctorBean doctorBean) {
		sqlSessionTemplate.insert("addDoctor", doctorBean);
		return doctorBean.getId();
	}

	@Override
	public boolean updateDoctor(DoctorBean doctorBean) {
		int n = sqlSessionTemplate.update("updateDoctor", doctorBean);
		return n > 0;
	}

	@Override
	public boolean delDoctor(DoctorBean doctorBean) {
		int n = sqlSessionTemplate.delete("delDoctor", doctorBean);
		return n > 0;
	}

	@Override
	public List<DoctorBean> queryDoctor(DoctorBean doctorBean) {

		return sqlSessionTemplate.selectList("queryDoctor", doctorBean);
	}

}
